package org.hhchat.leetcode.dp;

import java.util.Arrays;

/**
 * Created this one by HMH on 2017/6/12.
 */
public class code338 {
    public static class Solution {
        public int[] countBits(int num) {
            int dp[] = new int[num + 1];
            for(int i=0;i<=num;i++) {
                dp[i]=dp[i>>1]+(i&1);
            }
            return dp;
        }
    }
    public static void main(String[] args){
        Solution solution = new Solution();
        System.out.println(Arrays.toString(solution.countBits(5)));
    }
}
